<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
include 'pages.php';
?>
<form action="index.php?option=com_articlecashrewards" method="post" name="adminForm">
<?php defined('_JEXEC') or die('Restricted access'); ?>
<table class="adminlist" cellspacing="1">
    <tr>
        <td valign="top" width="20%">
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td align="right">
                        <div style="float: left;"><h2><?php echo JText::_("CPANEL_REPORTS")?></h2></div>
                    </td>
                    <td>
                        <div style="float: right;"><img src="components/com_articlecashrewards/assets/images/icon-48-acr-48.png"></div>
                    </td>
                </tr>
                <tr>
                    <td width="100%" colspan="2">
                        <div class="acrsubmenu">
                        <?php
                            foreach($reportpages as $report){?>
                                <a href="<?php echo $report->link ?>" class="acrlinkblock">
                                    <?php echo JText::_($report->text); ?>
                                </a><?php
                            }
                        ?>
                        </div>
                    </td>
                </tr>
            </table>
        </td>
        <td valign="top">
            <table class="adminlist" cellspacing="1">
                <thead>
                    <tr>
                        <th width="5">
                            <?php echo JText::_( 'Num' ); ?>
                        </th>
                        <th width="20">
                            <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->rows ); ?>);" />
                        </th>
                        <th class="title">
                            <?php echo JHTML::_('grid.sort', JText::_('LABEL_AUTHOR'), 'au.id', @$lists['order_Dir'], @$lists['order'] ); ?>
                        </th>
                        <th width="20%" class="title">
                            <?php echo JText::_('LABEL_PAYEE_NAME'); ?>
                        </th>
                        <th class="title">
                            <?php echo JText::_('LABEL_ADDRESS'); ?>
                        </th>
                        <th width="5%" class="title">
                            <?php echo JText::_('LABEL_PAYMENT_METHOD'); ?>
                        </th>
                        <th width="5%" class="title">
                            <?php echo JText::_('TOTAL_AMOUNT_ACCRUED'); ?>
                        </th>
                        <th width="5%" class="title">
                            <?php echo JText::_('LABEL_PAY_AMOUNT'); ?>
                        </th>
                        <th width="5%" class="title">
                            <?php echo JText::_('LABEL_STATUS'); ?>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    if($this->rows){
                        $k = 0;
                        $i = 0;
                        $user =& JFactory::getUser();
                        foreach ($this->rows as $row){
                            $checked 	= JHTML::_('grid.id', $i,  $row->id  );
                            ?>
                            <tr class="<?php echo "row$k"; ?>">
                                <td align="left">
                                    <?php echo $this->pagination->getRowOffset( $i); ?>
                                </td>
                                <td align="left">
                                    <?php echo $checked; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->username; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->payee_name; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->mailing_address; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->payment_method; ?>
                                </td>
                                <td align="left">
                                    <?php echo $row->cash; ?>
                                </td>
                                <td align="left" style="background-color: #FFEEBB; font-weight: bold;">
                                    <?php echo $row->amount_paid; ?>
                                </td>
                                <td align="left">
                                    <?php
                                    $status_image = '';
                                    if($row->security_code == 1){
                                        $status_image = "completed.png";
                                    }else if($row->security_code == "2"){
                                        $status_image = "completed.png";
                                    }else{
                                        $status_image = "pending_validate.png" ;
                                    }
                                    ?>
                                    <img src="components/com_articlecashrewards/assets/images/<?php echo $status_image; ?>"
                                        title="<?php echo ($row->security_code != '1' && $row->security_code != '2' )? "Validation Pending: ".$row->security_code:'' ;?>">
                                </td>
                            </tr>
                            <?php
                            $k = 1 - $k;
                            $i++;
                        }
                    }
                    ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="9" nowrap="nowrap"><?php echo $this->pagination->getListFooter(); ?></td>
                    </tr>
                </tfoot>
                <input type="hidden" name="option" value="com_articlecashrewards" />
                <input type="hidden" name="controller" value="reports" />
                <input type="hidden" name="task" value="pendingpayments" />
                <input type="hidden" name="pnlimitstart" value="<?php echo $this->pagination->limitstart; ?>" />
                <input type="hidden" name="boxchecked" value="0" />
                <?php echo JHTML::_( 'form.token' ); ?>
            </table>
        </td>
    </tr>
</table>
</form>
